<?php
if ($use_username) {
	$username = array(
		'name'	=> 'username',
		'id'	=> 'username',
		'value' => set_value('username'),
		'maxlength'	=> $this->config->item('username_max_length', 'tank_auth'),
		'size'	=> 30,
                'class' => 'form-control',
	);
}
$email = array(
	'name'	=> 'email',
	'id'	=> 'email',
	'value'	=> set_value('email'),
	'maxlength'	=> 80,
	'size'	=> 30,
        'class' => 'form-control',
);
$password = array(
	'name'	=> 'password',
	'id'	=> 'password',
	'value' => set_value('password'),
	'maxlength'	=> $this->config->item('password_max_length', 'tank_auth'),
	'size'	=> 30,
        'class' => 'form-control'
);
$confirm_password = array(
	'name'	=> 'confirm_password',
	'id'	=> 'confirm_password',
	'value' => set_value('confirm_password'),
	'maxlength'	=> $this->config->item('password_max_length', 'tank_auth'),
	'size'	=> 30,
        'class' => 'form-control'
);
$captcha = array(
	'name'	=> 'captcha',
	'id'	=> 'captcha',
	'maxlength'	=> 8,
        'class' => 'form-control',
);
$submit = array(
        'name' => 'submit',
        'id'   => 'submit',
        'class' => 'form-control btn btn-success pull-right',
        'value' => 'Submit',
        'data-loading-text' => 'wait...',
);

?>

<!-- NEW STUFF -->
<div class="alert alert-info alert-dismissable">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
    <span class="glyphicon glyphicon-info-sign"></span> Already have an account? <a class="alert-link" href="#">Log in</a>.
</div>

<div class="row">
    <div class="col-xs-12 col-md-4 col-md-offset-4 form-group" id="login-frame">
        <?php echo form_open('auth/register', 'class="form-inline" role="form"'); ?>
        
        <!-- username -->
        <div class="form-group has-error has-feedback">
            <label class="control-label" for="username">Choose a unique username</label>
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label">Username</span>
                <?php echo form_input($username); ?>
                <span class="glyphicon glyphicon-remove form-control-feedback"></span>
            </div> 
        </div>
        <br><br>
        
        <!-- email -->
        <div class="form-group has-success has-feedback">
            <label class="control-label" for="email">Enter a valid email</label>
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label">Email</span>
                <?php echo form_password($email); ?>
                <span class="glyphicon glyphicon-ok form-control-feedback"></span>
            </div>
        </div
        <br><br><br>
        
        <!-- password -->
        <div class="form-group">
            <label class="control-label" for="username">Define a secure password</label>
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label">Password</span>
                <?php echo form_password($password); ?>
            </div>
        </div>
        
        <!-- confirm password -->
        <div class="form-group">
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label"> Confirm</span>
                <?php echo form_password($captcha); ?>
            </div>
        </div>
        <br><br>
        
        <!-- captcha -->
        <div class="form-group">
            <label class="help-block" for="captcha">Verify that you're human</label>
            <?php echo $captcha_html; ?>
            <div class="col-md-12 input-group">
                <span class="input-group-addon login-label"> Code</span>
                <?php echo form_input($captcha); ?>
            </div>
        </div>
        <br><br>
        
        <?php echo form_submit($submit); ?>
        <?php echo form_close(); ?>    
    </div>
</div>

<!-- OLD STUFF -->
<?php 
echo form_error($username['name']);
echo isset($errors[$username['name']])?$errors[$username['name']]:'';
echo form_error($email['name']);
echo isset($errors[$email['name']])?$errors[$email['name']]:'';
echo form_error($password['name']);
echo form_error($confirm_password['name']);
echo form_error($captcha['name']);
?>